import java.util.Random;

public class Leetcode478 {

    class Solution {
        double xCenter;
        double yCenter;
        double radius;
        Random random;
        double powRadius;

        public Solution(double radius, double xCenter, double yCenter) {
            this.xCenter = xCenter;
            this.yCenter = yCenter;
            this.radius = radius;
            this.random = new Random();
            this.powRadius = radius * radius;
        }

        public double[] randPoint() {
            double randomX = radius * random.nextDouble() * 2 - radius;
            double randomY = radius * random.nextDouble() * 2 - radius;

            return checkPoint(randomX, randomY) ? new double[]{xCenter + randomX, yCenter + randomY} : randPoint();
        }

        private boolean checkPoint(double x, double y) {
            return x * x + y * y <= powRadius;
        }
    }

}
